package anthology.daily_question._24_10;
//https://leetcode.cn/problems/find-the-winner-of-an-array-game/description/
public class _1535找出数组游戏的赢家 {
    //灵神
    public int getWinner(int[] arr, int k) {
        int max = arr[0];
        int win = 0;
        for(int i=1; i<arr.length && win<k; i++){
            if(arr[i] > max){
                max = arr[i];
                win = 0;
            }
            win++;
        }
        return max;
    }
}
